import {Input, Button} from 'element-react';
import withRouter from '../../router/withRouter';
import React from 'react';

class Login extends React.Component {
  
  constructor(props) {
    super(props)
    this.state = {
      form: {
        inputValue: '1232'
      }
    }
  }

  onClick() {
    localStorage.setItem('token', this.state.form.inputValue)
    this.props.navigate('/')
  }

  onChange(key, value) {
    this.state.form[key] = value;
    this.forceUpdate();
  }

  render() {
    return (
      <div>
        <p>login</p>
        <Input value={this.state.form.inputValue} onChange={this.onChange.bind(this, 'inputValue')} placeholder='请输入token' />
        <Button onClick={this.onClick.bind(this)} >登录</Button>
      </div>
    )
  }
}

export default withRouter(Login)